﻿#pragma once

#include "Types.h"
#include "Exception.h"
#include "Util.h"

#include <stdexcept>

namespace Lisp
{

  template <typename T>
  class StaticList
  {
  public:
    class Node
    {
    public:
      Node(StaticList<T> &list, const std::string &symbol, T item) : m_symbol(symbol), m_item(item)
      {
        list.Add(*this);
      }

      const std::string &Symbol() const { return m_symbol; }
      T &Item() { return m_item; }

    private:
      T m_item;
      const std::string m_symbol;
    };

    void Add(const Node &node)
    {
      m_list.push_back(node);
    }

    // itr

    typename std::vector<Node>::iterator begin() { return m_list.begin(); }
    typename std::vector<Node>::iterator end() { return m_list.end(); }

  private:
    std::vector<Node> m_list;
  };
}